package com.dog.basics.admin.controller.mtkj;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.mtkj.FlowingWaterFromDto;
import com.dog.basics.bean.dto.admin.mtkj.ShoppFlowingWaterFromDto;
import com.dog.basics.bean.vo.admin.mtkj.FlowingWaterVo;
import com.dog.basics.bean.vo.admin.mtkj.ShoppFlowingWaterVo;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.mtkj.IMtFlowingWaterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商城资金流水 前端控制器
 * </p>
 *
 * @author wph
 * @since 2020-11-09
 */
@RestController
@RequestMapping("/pc/flowing/water")
@Api(value = "商城流水模块", tags = "商城流水模块")
@AllArgsConstructor
public class MtFlowingWaterController {
    private final IMtFlowingWaterService mtFlowingWaterService;

    /**
     * @Description: 商城流水列表
     * @Param: FlowingWaterFromDto
     * @return: IPage<FlowingWaterVo>
     * @Author: wph
     * @Date:
     */

    @ApiOperation(value = "商城流水列表", notes = "pc:mtFlowingWater:page")
    @GetMapping("/page")
    @PreAuthorize("@pms.hasPermission('pc:mtFlowingWater:page')")
    public R<IPage<ShoppFlowingWaterVo>> page(PageParam page, ShoppFlowingWaterFromDto obj) {
        IPage<ShoppFlowingWaterVo> list = mtFlowingWaterService.getPageList(page, obj);
        return R.ok(list);
    }


    /**
     * @Description: 删除商城流水
     * @Param: ids
     * @return: Boolean
     * @Author: wph
     * @Date: 2020/05/19  0027
     */
    @SysLog("删除商城流水")
    @ApiOperation(value = "删除商城流水", notes = "pc:mtFlowingWater:delete")
    @ApiImplicitParam(value = "商城流水Id", name = "id", dataType = "Long", required = true)
    @DeleteMapping("/delete/{id}")
    @PreAuthorize("@pms.hasPermission('pc:mtFlowingWater:delete')")
    public R<Boolean> delete(@PathVariable("id") Long id) {
        return R.ok(mtFlowingWaterService.deleteObj(id));
    }

}
